#Include tools.ahk

#MaxHotkeysPerInterval 1000
SetKeyDelay, 0, 250
SetTitleMatchMode, RegEx
CoordMode Pixel, Relative
CoordMode Mouse, Relative

Esc:: Reload

$F1::
GoSub, SetView
Loop {
	Loop, 14 {
		MouseClick,, 1010, 550,, 4
		Sleep 2500
		MouseMove, 170, 300, 0
		Sleep 250
		if(IsTooltip() == 1) {
			break
		}
		MouseClick,, 920, 550,, 4
		Sleep 2500
		MouseMove, 170, 300, 0
		Sleep 250
		if(IsTooltip() == 1) {
			break
		}
	}
	MouseClick,, 35, 80,, 4 
	MouseClick,, 538, 733,, 4
	Sleep 5000
	MouseClick,, 1060, 680,, 4
	Sleep 35000
	MouseClick,, 1020, 190,, 4
	Sleep 5000
	MouseClick,, 915, 415,, 4
	Sleep 1000
	MouseClick,, 873, 454,, 4
	Sleep 1000
	MouseClick,, 1060, 680,, 4
	Sleep 18000
	MouseClick,, 700, 340,, 4
	Sleep 5500
	MouseClick,, 1060, 680,, 4
	Sleep 55000
	;get to bank
	MouseClick,, 1796, 256,, 4
	Sleep 7000
	MouseMove,964,568,4
	Loop {
		if(IsTooltip() == 1)
		{
			result := PHashResult("BankDeposit.png",69,31)
			if(result <= 30)
			{
				MouseGetPos, xLoc, yLoc
				MouseClick,,0,28,,0,,R
				MouseMove,xLoc,yLoc,0
				Sleep 250
				misses := 0
				break
			}
			MouseMove,0,0
		}
		misses := misses + 1
		offset := 50 + misses
		if(A_Index < 50) {
			Random, randX, 880, 1050
			Random, randY, 444, 666
		} else {
			Random, randX, 206, 1600
			Random, randY, 30, 900
		}
		MouseMove, randX, randY, 0
		Sleep 100
	}
	
	Sleep 7000
	MouseClick,, 997, 638,, 4
	Sleep 2000
	MouseClick,, 1121, 407,, 4
	Sleep 2000
	;get back to clay
	MouseClick,, 1198, 439,, 4
	Sleep 4000
	
}
Return

Deposit:
MouseClick,, 1005,645,, 4
Sleep 1000
return

SetView:
MouseMove 1070,415,4
Loop, 50 {
Click WheelDown
Sleep 10
}
MouseClick,, 1645,80,, 4
Sleep 250
Send {w down}
Sleep 1000
Send {w up}
Sleep 250
return

